#include "Constant.h"
#include <string.h>

Constant::Constant(bool con)
	: _constant(con)
{

}

Constant::~Constant()
{
}

bool Constant::Evaluate(Context& aContext)
{
	std::cout << ReturnType() << std::endl;
	return _constant;
}

BooleanExp* Constant::Replace(const char* name, BooleanExp& exp)
{
	if (
		(strcmp(name, "true") == 0) && (_constant == true) ||
		(strcmp(name, "false") == 0) && (_constant == false)
		)
	{
		return exp.Copy();
	} 
	else
	{
		return new Constant(_constant);
	}
}

BooleanExp* Constant::Copy() const
{
	return new Constant(_constant);
}

char* Constant::ReturnType()
{
	return "Constant";
}
